import React from "react";
import { Form, Row, Col,FormInstance } from "antd";
interface formItem {
    name: string,
    label: string,
    child: JSX.Element
}
interface SearchFormProps {
    form:any
    formList: formItem[],   
    getFieldsValue:FormInstance,
    setFieldsValue:FormInstance,
    children?:JSX.Element
}


const SearchForm:React.FC<any>= (props: SearchFormProps) => {
    // const form = Form.useFormInstance();
    const { formList, children,form} = props
    return (
        <Form layout="inline" style={{ width: '100%' }}  form={form}>
            <Row >
                {
                    formList.map(it => {
                        return (
                            <Form.Item name={it.name} label={it.label} key={it.name}>
                                {it.child}
                            </Form.Item>
                        )
                    })
                }

            </Row>
            {
                children
            }
        </Form>
    )
}

export default SearchForm